<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <!-- 引入 ECharts 文件 -->
    <script src="echarts.min.js"></script>
    <script src="jquery-3.6.0.min.js"></script>
    <link rel="stylesheet" href="layui/css/layui.css">

</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>消费情况一览</legend>
</fieldset>
<br>
<div id="main" style="width: 600px;height:400px;"></div>
<script type="text/javascript">
    var In;
    var Out;
    $.ajax({
        url:"./tal/count",
        type:'get',
        success:function (res) {
            In=res.in;
            Out=res.out;
            // 基于准备好的dom，初始化echarts实例
            var myChart = echarts.init(document.getElementById('main'));

            // 指定图表的配置项和数据
            var option = {
                tooltip: {},
                legend: {
                    data:['消费情况']
                },
                xAxis: {
                    data: ["收入","支出"]
                },
                yAxis: {},
                series: [{
                    name: '消费情况',
                    type: 'bar',
                    data: [In,Out]
                }]
            };

            // 使用刚指定的配置项和数据显示图表。
            myChart.setOption(option);

        }
    });


</script>
</body>
</html>